const db = require('../config/db');
const Sequelize = db.sequelize;
const User = Sequelize.import('../schema/user');
User.sync({force: false})

class UserModel {

    /**
     *  创建用户 
     */
    static async create(params) {
        return await User.create(params);      
    }

    /**
     * 查询用户列表
     */
    static async findAllUserList(){
        return await User.findAll({
            attibutes: ['id']
        })
    }

    /**
     * 查询用户信息
     */
     static async findUser(openid) {
         return await User.findOne({
            where: {
                openid
            }
         })
     }
}

module.exports = UserModel